<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>新增体侧记录</title>
	<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no" name="viewport">
	<link rel="stylesheet" href="css/reset.css">
	<link rel="stylesheet" href="css/bosscoach.css">
	<link rel="stylesheet" href="css/flexible.css">
	<link rel="stylesheet" href="css/vant.css">
	<script src="js/jquery-3.3.1.min.js"></script>
	<script src="js/fontsize.js"></script>
	<script src="js/feedback.js"></script>
    <script src="js/vue/vue.js"></script>
    <script src="js/vue/axios.js"></script>
    <script src="js/vue/vant.js"></script>
    <script src="js/glabe.js"></script>
    <script src="js/jquery.md5.js"></script>
    <script src="js/vue/qs.js"></script>
</head>
<body>
<div class="system_feedback" id="app">
	<template>
		<div class="supplementary_details">
			<div style="width: 50%" class="lf">
				<label class="labe">身&nbsp;&nbsp;高：</label>
				<input oninput = "value=value.replace(/[^\d.]/g,'')" type="text" maxlength="5"  class="enter_mobile" v-model="Height">
				<label class="fontsize12">cm</label>
			</div>
			<div style="width: 50%" class="lf">
				<label class="labe">体&nbsp;&nbsp;&nbsp;重：</label>
				<input oninput = "value=value.replace(/[^\d.]/g,'')" type="text" maxlength="5"  class="enter_mobile" v-model="Weight">
				<label class="fontsize12">kg</label>
			</div>
	
			<div style="width: 50%" class="lf">
				<label class="labe">B&nbsp;M&nbsp;&nbsp;I：</label>
				<input oninput = "value=value.replace(/[^\d.]/g,'')" type="text"  maxlength="5"  class="enter_mobile" v-model="Bmi">
				<label class="fontsize12">KG/M2</label>
			</div>
			<div style="width: 50%" class="lf">
				<label class="labe">体&nbsp;&nbsp;&nbsp;脂：</label>
				<input oninput = "value=value.replace(/[^\d]/g,'')" type="text" maxlength="5" class="enter_mobile" v-model="Bodyfat">
				<label class="fontsize12">%</label>
			</div>
			
			<div style="width: 50%" class="lf">
				<label class="labe">臀&nbsp;&nbsp;&nbsp;围：</label>
				<input oninput = "value=value.replace(/[^\d.]/g,'')" type="text" maxlength="5" class="enter_mobile" v-model="Hipline">
				<label class="fontsize12">cm</label>
			</div>
			<div style="width: 50%" class="lf">
				<label class="labe">胸&nbsp;&nbsp;&nbsp;围：</label>
				<input oninput = "value=value.replace(/[^\d.]/g,'')" type="text" maxlength="5" class="enter_mobile" v-model="Bust">
				<label class="fontsize12">cm</label>
			</div>
					
			<div style="width: 50%" class="lf">
				<label class="labe">腰&nbsp;&nbsp;&nbsp;围：</label>
				<input oninput = "value=value.replace(/[^\d.]/g,'')" type="text" maxlength="5" class="enter_mobile" v-model="Thewaist">
				<label class="fontsize12">cm</label>
			</div>
			<div style="width: 50%" class="lf">
				<label class="labe">肩&nbsp;&nbsp;&nbsp;宽：</label>
				<input oninput = "value=value.replace(/[^\d.]/g,'')" type="text" maxlength="5" class="enter_mobile" v-model="Shoulder">
				<label class="fontsize12">cm</label>
			</div>

	
			<div style="width: 50%" class="lf">
				<label class="labe">小腿围：</label>
				<input oninput = "value=value.replace(/[^\d.]/g,'')" type="text" maxlength="5" class="enter_mobile" v-model="Minthigh">
				<label class="fontsize12">cm</label>
			</div>
			<div style="width: 50%" class="lf">
				<label class="labe">大腿围：</label>
				<input oninput = "value=value.replace(/[^\d.]/g,'')" type="text" maxlength="5" class="enter_mobile" v-model="Maxthigh">
				<label class="fontsize12">cm</label>
			</div>	
			<textarea  id="personal_opinion" placeholder="请输入备注信息" maxlength="50" v-model="Info"></textarea>
		</div>
	</template>
	<div class="submit_feedback" @click="submitData()">提交</div>
</div>
<div class="technology clearfix">由馆家提供技术支持</div>
</body>
<script>
	var app = new Vue({
		el: '#app',
		data: {
			//会员id
			id:null,
			//身高
			Height:null,
			//体重
			Weight:null,
			//Bmi
			Bmi:null,
			//体脂
			Bodyfat:null,
			//臀围
			Hipline:null,
			//胸围
			Bust:null,
			//腰围
			Thewaist:null,
			//肩宽
			Shoulder:null,
			//小腿围
			Minthigh:null,
			//大腿围
			Maxthigh:null,
			//备注信息
			Info:null
		},
		created() {
			//获取路由参数
			let id = getUrlQueryString('id');
			this.id = id;
		},
		methods: {
			//提交按钮
			submitData(){
				let Height = this.Height;
				let Weight = this.Weight;
				let Bmi = this.Bmi;
				let Bodyfat = this.Bodyfat;
				let Hipline = this.Hipline;
				let Bust = this.Bust;
				let Thewaist = this.Thewaist;
				let Shoulder = this.Shoulder;
				let Minthigh = this.Minthigh;
				let Maxthigh = this.Maxthigh;
				let Info = this.Info;
				//验证
				if(Height == null || Height == ''){
					vant.Toast('请输入身高');
					return false;
				}
				if(Height<0){
					vant.Toast('请输入正确的身高');
					return false;
				}
				if(Weight == null || Weight == ''){
					vant.Toast('请输入体重');
					return false;
				}
				if(Weight<0){
					vant.Toast('请输入正确体重');
					return false;
				}
				if(Bmi == null || Bmi == ''){
					vant.Toast('请输入Bmi');
					return false;
				}
				if(Bodyfat == null || Bodyfat == ''){
					vant.Toast('请输入体脂');
					return false;
				}
				if(Hipline == null || Hipline == ''){
					vant.Toast('请输入臀围');
					return false;
				}
				if(Bust == null || Bust == ''){
					vant.Toast('请输入胸围');
					return false;
				}
				if(Shoulder == null || Shoulder == ''){
					vant.Toast('请输入肩宽');
					return false;
				}
				if(Minthigh == null || Minthigh == ''){
					vant.Toast('请输入小腿围');
					return false;
				}
				if(Maxthigh == null || Maxthigh == ''){
					vant.Toast('请输入大腿围');
					return false;
				}
				if(Info == null || Info == ''){
					vant.Toast('请输入备注信息');
					return false;
				}
				//格式数据
				let from = JSON.stringify({
					Height,
					Weight,
					Bmi,
					Bodyfat,
					Hipline,
					Bust,
					Thewaist,
					Shoulder,
					Minthigh,
					Maxthigh,
					Info,
					uid:this.id
				})
				let sign = md5(from);
				let obj = {
					from,
					sign
				}
				axios.post('mobileapi/boss/user_bodytest.php?act=add',Qs.stringify(obj)).then(res=>{
					if(res.data.code == 200){
						vant.Toast(res.data.msg);
						setTimeout(()=>{
							// history.go(-1);
							location.href = "Tcrecording.html?id="+this.id;
						},1500)
					}else{
						vant.Toast(res.data.msg);
					}
				}).catch(err=>{
					vant.Toast('请求发送失败，请重试')
				})
			}
		},
	})
</script>
</html>